﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq; 

namespace Jy123.Web.Manage.User.Guess
{
    public partial class GuessEdit : System.Web.UI.Page
    {

        private int guessID;
        protected void Page_Load(object sender, EventArgs e)
        {
            int userID;
            string strUserIdFromCookie = Common.Cookie.getCookie("UserID");
            if (string.IsNullOrEmpty(strUserIdFromCookie))
            {
                Response.Redirect("/");
            }
            userID = int.Parse(strUserIdFromCookie);

            if (!IsPostBack)
            {
                ShowGuessInfo();
            }
        }

        /// <summary>
        /// 显示竞猜信息
        /// </summary>
        private void ShowGuessInfo()
        {
            guessID = Convert.ToInt32(Request.QueryString["GuessID"]);

            Jy123.Model.User_Guess_Main modelGuess = new Jy123.BLL.User_Guess_Main().GetModel(guessID);

            hfID.Value = guessID.ToString();
            txt_Title.Text = modelGuess.Title;
            txt_Account.Text = modelGuess.Account;
            txt_Point.Text = modelGuess.Point.ToString();
            txt_Share.Text = modelGuess.Share.ToString();
            txt_Multiple.Text = modelGuess.Multiple.ToString();
            txt_SumPoint.Text = modelGuess.SumPoint.ToString();
            txt_GuessDays.Text = modelGuess.GuessDays.ToString();
            txt_SettlementDays.Text = modelGuess.SettlementDays.ToString();
            txt_OverTime.Text = modelGuess.OverTime.ToString();
            txt_OpenTime.Text = modelGuess.OpenTime.ToString();
            
        }

        /// <summary>
        /// 保存竞猜信息
        /// </summary>
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            new BLL.Guess.GuessSql().UpdateGuess(txt_Title.Text, txt_Account.Text, hfID.Value);   
        }

    }
}
